
<script>
	var url;
	$(document).ready(function(){
		// filter
		filter_add = function(){
			//alert('tada..');
			$('#dg-lifting_kkks_add').treegrid('load', {
				'ID_KPS' : $('#ID_KPS').val(),
				'BULAN' : $('#BULAN').val(),
				'TAHUN' : $('#TAHUN').val()
			});
		}
		
		$(function(){
			$('#dg-lifting_kkks_add').treegrid({url:base_url+'lifting_kkks/get_list'});
		});
		
		/* Kimochi */
		// set input
		set_value = function(idx, field, value){
			//console.log('idx : ' + idx + '; filed : ' + field + '; value : ' + value);
			
			$('#dg-lifting_kkks_add').treegrid('update',{
				'index': idx,
				'row': {
					field: value,
				}
			});
			
			console.log($('#dg-lifting_kkks_add').treegrid('getData'));
			
		}
		
		fm_input_barel = function(val, row){
			if(row.CD_PROD != 61 && row.isparent == false){ // dia minyak
				return '<input id="" value="'+val+'" onchange="javascript:set_value(\''+(row.id-1)+'\', \'BAREL\', this.value)" style="text-align:right;width:100%"/>';
			}else{
				return '';
			}
		}
		
		
		
	});
</script>

<table id="dg-lifting_kkks_add" title="" class="easyui-treegrid" 
		autoRowHeight="false" 
		fit="true" 
		IdField="idx" 
		treeField="NM_PROD" 
		toolbar="#toolbar_add"
		showFooter="false">
	<thead frozen="true"> 
		<tr>
			<th field="NM_PROD" align="left" width="200" >WILAYAH</th>
		</tr>
	</thead>
	<thead > 
		<tr>
			<th>Minyak Bumi</th>
			<th colspan="3">Gas Bumi</</th>
			<th>Harga Satuan</th>
			<th>Lifting Premium</th>
			<th>Premium</th>
			<th>Gross Revenue</th>
			<th>Net Back</th>
			
		</tr>
		<tr>
			<th formatter="fm_input_barel" data-options="field:'BAREL', width:100, align:'right', halign:'center'">BAREL</th>
			<th data-options="field:'MMBTU', width:100, align:'right', halign:'center'">MMBTU</th>
			<th data-options="field:'MSCF', width:100, align:'right', halign:'center'">MSCF</th>
			<th data-options="field:'MT', width:100, align:'right', halign:'center'">MT</th>
			<th data-options="field:'GROSS_PRICE', width:100, align:'right', halign:'center'">US$</th>
			<th data-options="field:'VOL_PREMIUM', width:100, align:'right', halign:'center'">BAREL</th>
			<th data-options="field:'PREMIUM_PRICE', width:100, align:'right', halign:'center'">US$</th>
			<th data-options="field:'GROSSREV', width:100, align:'right', halign:'center'">US$</th>
			<th data-options="field:'NETBACK', width:100, align:'right', halign:'center'">US$</th>
		</tr>
		
	</thead>
</table>
<div id="toolbar_add" style="padding:5px;height:auto">
	<div>
		<table width="930" border="0">
		  <tr>
			<td>Nama KKS</td>
			<td>: 
				<select id="ID_KPS" name="ID_KPS" style="width:200px;">
					<?=$this->prosedur_model->OptionNamaKKKS();?>
				</select>
			</td>
			<td>Bulan</td>
			<td>: 
				<select id="BULAN" name="BULAN" style="width:200px;">
					<?=$this->prosedur_model->OptionNamaBulan(array('value'=>$BULAN));?>
				</select>
			</td>
			<td>Tahun</td>
			<td>: 
				<input name="TAHUN" id="TAHUN" size="15" value="<?=$TAHUN?>">
			</td>
		  </tr>
		  <tr>
			<td>&nbsp;</td>
			<td>&nbsp;&nbsp;<a href="#" onclick="filter_add()" class="easyui-linkbutton" iconCls="icon-search">Filter</a></td>
			<td></td>
			<td>
			</td>
			<td></td>
			<td>
			</td>
		  </tr>
		</table>
	</div>
</div>